package com.example.mapper;

import com.example.pojo.Collection;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface CollectionMapper {

    List<Collection> selectAll(Collection collection);

    @Select("select * from collection where id = #{id}")
    Collection selectById(Integer id);

    void add(Collection collection);

    @Delete("delete from collection where user_id = #{userId} and room_id=#{roomId}")
    void deleteById(@Param("userId") Integer userId,@Param("roomId") Integer roomId);

    //查询是否重复收藏
    boolean existsByUserAndRoom(@Param("userId") Integer userId,@Param("roomId") Integer roomId);
}
